package site.xuxingcan.tvlauncher;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPreferenceUtil {
    private static volatile SharedPreferenceUtil instance = null;

    public static SharedPreferenceUtil getInstance(Context context) {
        if (instance == null) {
            synchronized (SharedPreferenceUtil.class) {
                if (instance == null) {
                    instance = new SharedPreferenceUtil(context);
                }
            }
        }
        return instance;
    }

    private SharedPreferences mSharedPreferences;

    private SharedPreferenceUtil(Context context) {
        mSharedPreferences = context.getSharedPreferences("default", Context.MODE_PRIVATE);
    }

    public String getAddress() {
        return mSharedPreferences.getString("Address", null);
    }

    public void setAddress(String s) {
        mSharedPreferences.edit().putString("Address", s).apply();
    }

}
